package viper

import (
	"flare-admin/config/common"
	"github.com/sirupsen/logrus"
	"github.com/spf13/viper"
)

var (
	BootCfg common.BootStrapConfig
)

func init() {
	viper.SetConfigName("application")
	viper.SetConfigType("yaml")
	viper.AddConfigPath(".")
	if err := viper.ReadInConfig(); err != nil {
		logrus.Fatalf("read config file failed: %v", err)
	}

	if err := viper.Unmarshal(&BootCfg); err != nil {
		logrus.Fatalf("unmarshal config file failed: %v", err)
	}
}
